<% title_attribute = (title = attributes.detect { |a| a.type.to_s == "string" }).present? ? title.name : 'title' -%>
<li class='clearfix record <%%= cycle("on", "on-hover") %>' id="<%%= dom_id(<%= singular_name %>) -%>">
  <span class='title'>
    <% if localized? %><%%= translated_field(<%= singular_name %>, :<%= title_attribute %>) %><% else %><%%= <%= singular_name %>.<%= title_attribute %> %><% end %>
  </span>
<% if localized? %>
  <%% if Refinery::I18n.frontend_locales.many? %>
    <span class='locales'>
      <%% <%= singular_name %>.translations.sort_by{ |t| Refinery::I18n.frontend_locales.index(t.locale)}.each do |translation| %>
        <%% if translation.<%= title_attribute %>.present? %>
          <%%= link_to refinery.edit_<%= namespacing.underscore %>_admin_<%= singular_name %>_path(<%= singular_name %>, :switch_locale => translation.locale),
                      class: 'locale', title: translation.locale.upcase do %>

            <div class="<%%=translation.locale %> locale_marker">
              <%%= locale_text_icon(translation.locale.upcase) %>
            </div>
          <%% end %>
        <%% end %>
      <%% end %>
    </span>
  <%% end %>
<% end %>
  <span class='preview'></span>

  <span class='actions'>
    <% unless skip_frontend? %><%%= action_icon(:preview, refinery.<%= namespacing.underscore %>_<%= singular_name %>_path(<%= singular_name %>), t('.view_live_html')) %><%end %>
    <%%= action_icon(:edit,    refinery.edit_<%= namespacing.underscore %>_admin_<%= singular_name %>_path(<%= singular_name %>), t('.edit') ) %>
    <%%= action_icon(:delete,  refinery.<%= namespacing.underscore %>_admin_<%= singular_name %>_path(<%= singular_name %>), t('.delete'),
      { class: "cancel confirm-delete",
        data: {confirm: t('message',  scope: 'refinery.admin.delete', title: <%=singular_name%>.<%=title_attribute %>)}}  ) %>
  </span>
</li>
